;$(function() {
	var id = $("#id").val();
	getInfo(id);
	getPrmissList(id);
})

function getInfo(id){
	   $.ajax({
        url: ctxPath+"/set/admin/findById/"+id,
        type: 'GET',
        success: function(d){
        	var success = d.success;
        	 if(success==true){
        	 var data=  d.data;
        	 if(data!=null){
        		 $("#dept_select").html(data.deptUser.deptName);
        		 $("#user_select").html(data.nickname);
        		 $("#username").html(data.username);
        	 }
        	}
        }
    });
}

/**
 * 获取权限
 * @returns
 */
function getPrmissList(userId){
	if(userId==null||userId==''){
		return;
	}
	$.ajax({
		url: ctxPath+"/set/permission/getPermission/"+userId,
		type: 'GET',
		success: function(d){
			var success = d.success;
			if(success==true){
				if(d.data!=null){
					var result ='';
					$.each(d.data,function(i,item){
						if(item.isCheck){
							result+='<label class="checkbox-inline"><input type="checkbox"  value="'+item.id+'" name="permissionList['+i+'].permissionId" checked disabled="disabled">'+item.menuName+'</label>';	
						}else{
							result+='<label class="checkbox-inline"><input type="checkbox"  value="'+item.id+'" name="permissionList['+i+'].permissionId" disabled="disabled">'+item.menuName+'</label>';	
						}
					})
					$("#modular").html(result);
				}	 
			}
			
		}
	})
}